<header>
    <div class="header3">
        <section>
            <h1><a href="/"><?= get_bloginfo('name'); ?></a></h1>
            <img src="<?= STATIC_PATH ?>/img/menu.svg">
        </section>

        <nav class="grid">
            <?php foreach (
                get_categories(array(
                    'taxonomy'   => 'category',
                    'hide_empty' => false, // Include empty categories
                    'orderby'    => 'name',
                    'order'      => 'ASC',
                )) as $vo
            ): ?>
                <?php if (intval($vo->parent) == 0): ?>
                    <a href="/category/<?= $vo->slug ?>"><?= $vo->name ?></a>
                <?php endif; ?>
            <?php endforeach; ?>
        </nav>
    </div>
</header>

<script>
    const menu = document.querySelector('header>div.header3>section>img');
    const nav = document.querySelector('header>div.header3>nav');
    
    menu.addEventListener('click', () => {
        nav.classList.toggle('show');
    });
    
</script>

<style>
    header {
        backdrop-filter: blur(10px);
        background-color: rgba(25, 25, 25, .8);
    }

    div.header3 {
        display: grid;
        grid-template-rows: 4rem;
    }

    div.header3>section {
        display: flex;
        justify-content: end;
        justify-items: end;
        align-items: center;
        gap: var(--gap);
        z-index: 666;
    }

    div.header3>section>h1>a {
        color: var(--color-primary);
    }

    div.header3>section>img {
        height: 3rem;
        width: 3rem;
        display: none;
    }

    div.header3>nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: end;
        transition: var(--transition);
    }

    div.header3>nav>a {
        padding: var(--gap);
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius);
        transition: var(--transition);
        background-color: var(--color-primary);
    }

    div.header3>nav.show {
        visibility: visible;
        height: auto;
        animation: expandHeight 0.3s ease-in-out;
    }
    @keyframes collapseHeight {
        from {
            height: 40rem;
        }
        to {
            height: 0;
        }
    }
   
    @keyframes expandHeight {
        from {
            height: 0;
        }
        to {
            height: 40rem;
        }
    }
    @media (max-width: 768px) {
        div.header3>section>img {
            display: block;
        }

        div.header3>section>h1 {
            font-size: 1.5rem;
        }

        div.header3>nav {
            flex-direction: column;
            align-items: start;
            visibility:hidden;
            height: 0;
            overflow: hidden;
            animation: collapseHeight 0.3s ease-in-out;
        }

        div.header3>nav>a {
            width: 100%;
            text-align: center;
        }
    }
</style>